#!/bin/bash
yt=`date -d "1 days ago "  "+%Y-%m-%d"`

mysql -uroot -proot -hhadoop3<<EOF  
use result;

truncate table res_notoil;
delete from  res_oil where minutes>='$yt';
delete from  res_oil_vip where minutes>='$yt';
delete from  res_notoil_vip where minutes>='$yt';
delete from res_notoilTop where minutes>='$yt';
delete from res_notoilDepartment where minutes>='$yt';
delete from res_notoilTop_vip where minutes>='$yt';
delete from res_recharge where date>='$yt';
delete from res_recharge_cd where date>='$yt';
delete from res_notoilTop where minutes>='$yt';
delete from res_notoilTop_vip where minutes>='$yt';
delete from res_lube where minutes>='$yt';
delete from res_notoilRate where hours>='$yt';
delete from res_notoilRate_vip where hours>='$yt';
delete from res_mop where minutes>='$yt';
delete from res_mop_vip where minutes>='$yt';
delete from res_HHTIPT where hours>='$yt';
delete from res_HHTIPT_vip where hours>='$yt';
truncate table res_oilPrice;
truncate table res_tr;
truncate table res_addVip;
truncate table res_vipChannel;
truncate table res_vipLiveness;
truncate table res_funnel;
truncate table res_vipFirstExpend;
truncate table res_vipGap;
truncate table res_vipDealMonth;
truncate table res_vipLastDeal;
truncate table res_credits;
truncate table res_creditsRate;
truncate table res_vipCoupon;
truncate table res_vipCouponRate;
truncate table res_vipRechargeMonth;
truncate table res_oilb;
truncate table res_mopipt;
truncate table res_mophht;
truncate table res_notoilDepartment_vip;
truncate table res_mopipt_vip;
truncate table res_mophht_vip;
truncate table res_exceptLube;
truncate table res_exceptLube_vip;
truncate table tag_result;
truncate table res_mopb;
truncate table res_mopb_vip;
truncate table res_notoilSearch;
truncate table res_couponTactic;
truncate table RFM;
truncate table RFM_cd;
truncate table res_hoseEfficiency;
truncate table res_mophhtb;
truncate table res_mophhtb_vip;
truncate table res_mopiptb;
truncate table res_mopiptb_vip;
truncate table res_addVip_cd;
truncate table res_vipChannel_cd;
truncate table res_vipLiveness_cd;
truncate table res_funnel_cd;
truncate table res_vipFirstExpend_cd;
truncate table res_vipGap_cd;
truncate table res_vipDealMonth_cd;
truncate table res_vipLastDeal_cd;
truncate table res_vipRechargeMonth_cd;
truncate table res_credits_cd;
truncate table res_creditsRate_cd;
truncate table res_notoilDepartmentb;
truncate table res_notoilDepartmentb_vip;
truncate table basket_bj;
truncate table basket_cd;
truncate table basket_all;
truncate table res_vipEvaluationb_all;
truncate table res_vipLiveness_year;
truncate table res_vipLiveness_yearcd;
truncate table res_vipLiveNess_stationall;
truncate table res_vipcoupon_ladder;
truncate table res_rechargeb;
truncate table res_rechargeb_cd;
truncate table res_wechatmall_status;
truncate table res_wechatmall_top;
truncate table res_vipThirtyDaysRate;
truncate table res_vipThirtyDaysRate_cd;
truncate table res_vipSixtyDaysRate;
truncate table res_vipSixtyDaysRate_cd;
truncate table res_vipDrain;
truncate table res_vipDrain_cd;
truncate table res_vipcoupon_station;
truncate table res_wechatmall_topall;
truncate table res_evaluation;
truncate table tag_result_ninety;
truncate table tag_result_thirty;
truncate table tag_result_sixty;
truncate table tag_result_ninety_cd;
truncate table tag_result_thirty_cd;
truncate table tag_result_sixty_cd;
truncate table tag_result_cd;
truncate table res_coupon;
truncate table res_coupon_send;
truncate table res_vipcoupon_source;
truncate table res_vipcoupon_oilnotoil;
truncate table res_vipcoupon_nature;
truncate table res_vipcoupon_discsource;
truncate table comparison_hiveb;
truncate table res_oilb_vip;
truncate table tag_result_alltime;
truncate table tag_result_alltimecd;
truncate table res_notoilSearch_vip;
truncate table res_openingdate;
truncate table vip_item;
truncate table vip_interval;
truncate table vip_interval_cd;
truncate table vip_coupon;
truncate table res_vipEvaluation_all;
EOF
exit;